# $OpenBSD: Makefile,v 1.106 2017/03/21 19:48:01 dcoppa Exp $

COMMENT=		highly configurable framework window manager

VER=			4.1
DISTNAME=		awesome-${VER}
EXTRACT_SUFX=		.tar.xz
CATEGORIES=		x11

HOMEPAGE=		https://awesomewm.org/

MAINTAINER=		David Coppa <dcoppa@openbsd.org>

# GPLv2+
PERMIT_PACKAGE_CDROM=	Yes

WANTLIB=		X11 c cairo dbus-1 execinfo \
			gdk_pixbuf-2.0 glib-2.0 gobject-2.0 \
			${MODLUA_WANTLIB} m \
			startup-notification-1 xcb xcb-cursor \
			xcb-icccm xcb-keysyms xcb-randr \
			xcb-render xcb-shape xcb-util \
			xcb-xinerama xcb-xkb xcb-xrm xcb-xtest \
			xdg-basedir xkbcommon-x11 xkbcommon

MASTER_SITES=		https://github.com/awesomeWM/awesome/releases/download/v${VER}/

MODULES=		devel/cmake \
			devel/gettext \
			lang/lua

MODLUA_VERSION=		5.2

LIB_DEPENDS=		devel/libexecinfo \
			devel/startup-notification \
			graphics/cairo \
			graphics/gdk-pixbuf2 \
			${MODLUA_LIB_DEPENDS} \
			x11/dbus \
			x11/libxdg-basedir \
			x11/xkbcommon

MODLUA_BUILD_DEPENDS=	devel/lua-lgi

BUILD_DEPENDS=		devel/lualdoc \
			textproc/asciidoc>=8.4.5 \
			textproc/xmlto \
			graphics/ImageMagick

MODLUA_RUN_DEPENDS=	devel/lua-lgi

RUN_DEPENDS=		devel/pango \
			misc/rlwrap \
			shells/bash

CONFIGURE_ARGS=		-DCOMPRESS_MANPAGES=off \
			-DGENERATE_DOC=off \
			-DSYSCONFDIR=${SYSCONFDIR}

SEPARATE_BUILD=		No

NO_TEST=		Yes

pre-configure:
	${SUBST_CMD} ${WRKSRC}/awesomeConfig.cmake \
		${WRKSRC}/lib/awful/completion.lua \
		${WRKSRC}/lib/awful/util.lua \
		${WRKSRC}/lib/beautiful/init.lua \
		${WRKSRC}/lib/menubar/icon_theme.lua \
		${WRKSRC}/lib/menubar/menu_gen.lua \
		${WRKSRC}/lib/naughty/core.lua \
		${WRKSRC}/themes/default/theme.lua \
		${WRKSRC}/themes/xresources/theme.lua \
		${WRKSRC}/utils/awesome-client

post-install:
	@rm ${WRKINST}${LOCALBASE}/share/awesome/lib/awful/*.{beforesubst,orig} \
		${WRKINST}${LOCALBASE}/share/awesome/lib/beautiful/*.{beforesubst,orig} \
		${WRKINST}${LOCALBASE}/share/awesome/lib/menubar/*.{beforesubst,orig} \
		${WRKINST}${LOCALBASE}/share/awesome/lib/naughty/*.{beforesubst,orig} \
		${WRKINST}${LOCALBASE}/share/awesome/themes/default/*.{beforesubst,orig} \
		${WRKINST}${LOCALBASE}/share/awesome/themes/xresources/*.{beforesubst,orig}
	${INSTALL_DATA_DIR} ${PREFIX}/share/examples/awesome
	@mv ${WRKINST}${SYSCONFDIR}/xdg/awesome/rc.lua \
		${PREFIX}/share/examples/awesome/

.include <bsd.port.mk>
